import 'package:dio/dio.dart';

import 'mock_adapter.dart';

class DioClientChat {
  static late Dio _dioChat;

  static void initialize() {
    _dioChat = Dio(BaseOptions(
      baseUrl: 'https://fc.hongfund.com:8503/', // 你的API基地址
      sendTimeout: const Duration(seconds: 500),
      connectTimeout: const Duration(seconds: 500),
      receiveTimeout: const Duration(seconds: 500),
      responseType: ResponseType.stream,
    ));

    // 添加Mock拦截器
    _dioChat.interceptors.add(MockAdapter());
    // 添加日志拦截器 (开发模式)
    _dioChat.interceptors.add(LogInterceptor(responseBody: true, requestBody: true));
  }

  static Dio get instance => _dioChat;
}
